package com.it.selfrequest.service.impl;

import com.it.selfrequest.mapper.TestMapper;
import com.it.selfrequest.pojo.Test;
import com.it.selfrequest.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class TestServiceImpl implements TestService {

    @Autowired
    private TestMapper testMapper;

    @Override
    public List<Test> getAll() {
        return testMapper.getTestAll();
    }

    @Override
    public Test getTestById(Long id) {
        return testMapper.getTestById(id);
    }

    @Override
    public String save(Test test) {
        return testMapper.save(test) > 0 ? "保存成功" : "报错失败";
    }

    @Override
    public String update(Test test) {
        return testMapper.update(test) > 0 ? "修改成功" : "修改失败";
    }

    @Override
    public String deleteTestById(Long id) {
        return testMapper.deleteById(id) > 0 ? "删除成功" : "删除失败";
    }

    @Override
    public List<Test> getTestByUsername(String username) {
        return testMapper.getTestByUsername(username);
    }

    @Override
    public String deleteTestByIds(List<Long> ids) {
        return testMapper.deleteTestByIds(ids) > 0 ? "批量删除成功" : "批量删除失败";
    }
}
